/*
 * CS_BATTLE_ROYAL_PARTNER_INFO.cpp
 *
 *  Created on: 2013. 12. 7.
 *      Author: the2
 */

#include "../../Command.h"
#include "../../engine.h"
#include "../../User.h"
#include "../../NLogic/Space.h"
#include "../../NLogic/Function.h"

namespace ProjectZ { namespace NCommand {

void Command::CS_BATTLE_ROYAL_PARTNER_INFO(User * pUser, ::Network::Packet * pPacket)
{
	STRESSLOG("CS_DUNGEON_PARTNER_INFO");

	NLogic::Space * pSpace = pUser->GetSpace();
	if (NULL == pSpace)
	{
		NLogic::NFunction::SendExceptionNoSpace(pUser);
		DEBUGLOG("CS_BATTLE_ROYAL_PARTNER_INFO pSpace is NULL");
		return;
	}

	if(	pSpace->GetData()._spaceType != NLogic::Space::SpaceType::BATTLEROYAL )
	{
		NLogic::NFunction::SendExceptionNoSpace(pUser);
		DEBUGLOG("CS_BATTLE_ROYAL_PARTNER_INFO space is not single or party dungeion");
		return;
	}

	PREPARE_PACKET;
	int target_gid = 0;
	* pPacket >> target_gid;

	User * pTarget = pSpace->FindUser(target_gid);
	if (pTarget == NULL)
	{
		DEBUGLOG("CS_BATTLE_ROYAL_PARTNER_INFO pTarget == NULL");
		::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
		* pAck << static_cast<int16_t>(ACK_NOT_EXIST_USER);
		* pAck << target_gid;
		pAck->MakePacket(CMD_SC_DUNGEON_PARTNER_INFO);
		pUser->Send(pAck);

		return;
	}

	NLogic::NFunction::SendCharacterDefaultInfo(pTarget, pUser);
	NLogic::NFunction::SendCharacterEquipInfo(pTarget, pUser);
}

} /*NCommand*/ } /*ProjectZ*/


